package com.futureCloudMOM.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.futureCloudMOM.core.base.service.impl.BaseServiceImpl;
import com.futureCloudMOM.core.domain.BasicWorkCenter;
import com.futureCloudMOM.core.service.BasicWorkCenterService;
import com.futureCloudMOM.core.mapper.BasicWorkCenterMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 【Basic_WorkCenter】的数据库操作Service实现
*
* @author Administrator
* @since 2023-06-06 15:19:30
*/
@Service
public class BasicWorkCenterServiceImpl extends BaseServiceImpl<BasicWorkCenterMapper, BasicWorkCenter> implements BasicWorkCenterService{

    @Override
    public List<BasicWorkCenter> getListByCodeOrName(BasicWorkCenter basicWorkCenter) {
        return list(new LambdaQueryWrapper<BasicWorkCenter>()
        .like(ObjectUtils.isNotEmpty(basicWorkCenter.getName()),BasicWorkCenter::getName,basicWorkCenter.getName())
        .like(ObjectUtils.isNotEmpty(basicWorkCenter.getCode()),BasicWorkCenter::getCode,basicWorkCenter.getCode())
        .eq(BasicWorkCenter::getDeleted,0)
        .orderByDesc(BasicWorkCenter::getSysCreateTime));
    }
}
